project(db)

set(CMAKE_CXX_STANDARD 20)

set(LOCAL_DIR .)

set(LOG_DIR ./Log)
set(LOG
    ${LOG_DIR}/Buffer.hpp
    ${LOG_DIR}/Buffer.cpp
    ${LOG_DIR}/LogFile.hpp
    ${LOG_DIR}/LogFile.cpp
    ${LOG_DIR}/Logger.hpp
    ${LOG_DIR}/Logger.cpp
    ${LOG_DIR}/CountDownLatch.hpp
    ${LOG_DIR}/CountDownLatch.cpp
)

set(OBJECT_DIR ./Object)
set(OBJECT
    ${OBJECT_DIR}/HashObject.hpp
    ${OBJECT_DIR}/HashObject.cpp
    ${OBJECT_DIR}/ListObject.hpp
    ${OBJECT_DIR}/ListObject.cpp
    ${OBJECT_DIR}/Object.hpp
    ${OBJECT_DIR}/Object.cpp
    ${OBJECT_DIR}/SetObject.hpp
    ${OBJECT_DIR}/SetObject.cpp
    ${OBJECT_DIR}/StringObject.hpp
    ${OBJECT_DIR}/StringObject.cpp
    ${OBJECT_DIR}/ZsetObject.hpp
    ${OBJECT_DIR}/ZsetObject.cpp
)

set(STRUCTURT_DIR ./Structurt)
set(STRUCTURT
    ${STRUCTURT_DIR}/Linker.hpp
    ${STRUCTURT_DIR}/Linker.cpp
    ${STRUCTURT_DIR}/Sds.hpp
    ${STRUCTURT_DIR}/Sds.cpp
    ${STRUCTURT_DIR}/Skiplist.hpp
    ${STRUCTURT_DIR}/Skiplist.cpp
)

set(FILE_LIST
    ${LOCAL_DIR}/Alloc.hpp
    ${LOCAL_DIR}/Alloc.cpp
    ${LOCAL_DIR}/Aof.hpp
    ${LOCAL_DIR}/Aof.cpp
    ${LOCAL_DIR}/Database.hpp
    ${LOCAL_DIR}/Database.cpp
    ${LOCAL_DIR}/Excutor.hpp
    ${LOCAL_DIR}/Excutor.cpp
    ${LOCAL_DIR}/Malloc.hpp
    ${LOCAL_DIR}/Paser.hpp
    ${LOCAL_DIR}/Paser.cpp
    ${LOCAL_DIR}/Tool.hpp
    ${LOCAL_DIR}/Tool.cpp
)

add_library(
    db 
    ${FILE_LIST}
    ${OBJECT}
    ${LOG}
    ${STRUCTURT}
)
target_link_libraries(db base)
target_link_libraries(db sock)